/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mycompany.ingsoc2;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author sfreiman
 */
public class VcLstPrincipalFiltrar implements ActionListener {

    private VcPrincipalView myView;
    private VcPrincipalModel myModel;
/**
 * 
 * @param MV
 * @param MM 
 */
    public VcLstPrincipalFiltrar(VcPrincipalView MV, VcPrincipalModel MM) {
        this.myView = MV;
        this.myModel = MM;
    }
/**
 * 
 * @param e 
 */
    public void actionPerformed(ActionEvent e) {
        String txtTitulo;
        String txtDirector;
        List<Pelicula> milista;
        txtDirector = this.myView.getTxtDirector();
        txtTitulo = this.myView.getTxtTitulo();
        try {
            milista = myModel.filtrar(-1,txtTitulo, txtDirector,this.myView.getSelectedGenero());
            myView.mostrarResultado(milista);
        } catch (SQLException ex) {
            Logger.getLogger(VcLstPrincipalFiltrar.class.getName()).log(Level.SEVERE, null, ex);
        }


    }
}
